import os

from Config.Params import ROOT_DIR


def getDapDir():
    return os.path.join(ROOT_DIR, "Raww/dap.db")
def getDefaultDb():
    return upperIfNotExists("./raw/connections/default.db")
def getDbByName(dbName):
    fPath = os.path.join("./raw/connections",dbName)
    # fPath = os.path.join(ROOT_DIR, "raw/connections/preference.sqlite")
    fPath = upperIfNotExists(fPath)
    return fPath
def upperIfNotExists(fPath:str):
    print("yzprt os.path.exists(fPath):", os.path.exists(fPath))
    if not os.path.exists(fPath):
        fPath = "."+fPath
    print("yzprt final fPath@upperIfNotExists:", fPath)
    return fPath
def getDesktopDir():
    return os.path.join(os.path.expanduser('~'),"Desktop")
def getPurePath(filePath):
    path, fileName = os.path.split(filePath)
    return path
def getFileName(filePath):
    path, fileName = os.path.split(filePath)
    return fileName
def getFileNa(filePath):
    path, fileName = os.path.split(filePath)
    (fileNa, extension) = os.path.splitext(fileName)
    return fileNa
def getExtention(filePath):
    path, fileName = os.path.split(filePath)
    (fileNa, extension) = os.path.splitext(fileName)
    return extension
def getFilePathWithSuffix(filePath,suffix):
    path, fileName = os.path.split(filePath)
    (fileNa, extension) = os.path.splitext(fileName)
    return os.path.join(path,fileNa+"_"+suffix+extension)